package com.zb.api.common.models;

import lombok.Data;

@Data
public class ServerResponse {
    private Integer code;
    private String msg;
    private Object data;

    public ServerResponse() {

    }
    public ServerResponse(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ServerResponse(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ServerResponse(String msg, Object data) {
        this.msg = msg;
        this.data = data;
    }

    public ServerResponse(Object data) {
        this.data = data;
    }

    public static ServerResponse success(String message) {
        return new ServerResponse(200,message);
    }
    public static ServerResponse success(String message,Object data) {
        return new ServerResponse(200,message,data);
    }
    public static ServerResponse error(int code, String message) {
        return new ServerResponse(code,message);
    }
}
